import { takeEvery, put } from "redux-saga/effects"
import axios from "axios"

function* loadArticles(payload) {
  let { data } = yield axios.get("/articles", {
    params: payload,
  })
  console.log(data)
  yield put({
    type: "loadArticlesSuccess",
    payload: data.articles,
  })
}

export default function* articleSaga() {
  yield takeEvery("loadArticles", loadArticles)
}
